package jdk9;

import org.junit.Test;

import java.util.HashSet;
import java.util.Set;
public class DiamondOperator {

    @Test
    public void testDiamondOperator(){
        diamondOperator();
    }

    public void diamondOperator(){
        //创建一个继承于HashSet的匿名子类的对象
    	//jdk9以前编译不通过
        Set<String> set = new HashSet<>(){
			private static final long serialVersionUID = 91614352776073112L;
		};
		
        set.add("MM");
        set.add("JJ");
        set.add("GG");
        set.add("DD");

        for(String s : set){
            System.out.println(s);
        }

    }
}
